package com.itheima.controller;

import com.itheima.domain.Items;
import com.itheima.service.ItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("itemsController")
public class ItemsController {
    @Autowired
    private ItemsService service;
    @RequestMapping("findAll")
    public ModelAndView findAll(ModelAndView mv){
        System.out.println("ItemsController的findAll执行");
        List<Items> items = service.findAll();
        mv.setViewName("itemDetail");
        mv.addObject("list",items);
        return mv;
    }
}
